package com.wendu.oa.dao.security;

import com.wendu.oa.dto.UserDto;
import com.wendu.oa.model.Role;
import com.wendu.oa.model.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserDao {
    List<User> findUserList(UserDto userDto);

    @Delete("delete from t_ur where u_id = #{u_id}")
    void deleteUserAllRoles(String u_id);

    void insertUserRoles(@Param("u_id")String u_id, @Param("ro_ids")Integer[] ro_ids);

    List<Role> findRoleList();

    @Select("select ro_id from t_ur where u_id = #{u_id}")
    Integer[] findUserRoleIds(String u_id);
}
